package cn.iocoder.yudao.module.alipay.controller.app.infoslideshowtype;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.alipay.controller.admin.infoslideshowtype.vo.*;
import cn.iocoder.yudao.module.alipay.convert.infoslideshowtype.InfoSlideshowTypeConvert;
import cn.iocoder.yudao.module.alipay.dal.dataobject.infoslideshowtype.InfoSlideshowTypeDO;
import cn.iocoder.yudao.module.alipay.service.infoslideshowtype.InfoSlideshowTypeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;

@Tag(name = "小程序App - 轮播图分类")
@RestController
@RequestMapping("/alipay/info-slideshow-type")
@Validated
public class InfoSlideshowTypeAppController {

    @Resource
    private InfoSlideshowTypeService infoSlideshowTypeService;


    @GetMapping("/get")
    @Operation(summary = "获得轮播图分类")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    public CommonResult<InfoSlideshowTypeRespVO> getInfoSlideshowType(@RequestParam("id") Long id) {
        InfoSlideshowTypeDO infoSlideshowType = infoSlideshowTypeService.getInfoSlideshowType(id);
        return success(InfoSlideshowTypeConvert.INSTANCE.convert(infoSlideshowType));
    }

    @GetMapping("/list")
    @Operation(summary = "获取全部分类")
    public CommonResult<List<InfoSlideshowTypeRespVO>> getInfoSlideshowTypeList() {
        List<InfoSlideshowTypeDO> list = infoSlideshowTypeService.getInfoSlideshowTypeList();
        return success(InfoSlideshowTypeConvert.INSTANCE.convertList(list));
    }

}
